package com.amlyc.demo2;

public class StaticProxy {
    public static void main(String[] args) {

        new Thread(()->System.out.println("love")).start();
        new WeddingCompany(new You()).Happymarry();

    }
}
interface Marry{

    void Happymarry();
}
class You implements Marry{

    @Override
    public void Happymarry() {
        System.out.println("happ marry");
    }
}
class WeddingCompany implements Marry{
    private Marry target;

    public WeddingCompany(Marry target) {
        this.target = target;
    }

    @Override
    public void Happymarry() {
           before();
           this.target.Happymarry();
           after();
            
    }

    private void after() {
        System.out.println("after");
    }

    private void before() {
        System.out.println("before");
    }


}
